package com.bdth.mixapi.api.vo;

import java.util.List;

/**
 * API所需实体列表json样式对象
 * @Date 2019-04-10
 * @Auth LGP
 */
public class CommonList<T> {
    private String code;
    private String message;
    private List<T> list;

    public CommonList(String code, String message, List<T> list) {
        this.code = code;
        this.message = message;
        this.list = list;
    }

    /**
     * 成功消息
     * @param list
     * @param <T>
     * @return
     */
    public static<T> CommonList<T> success(List<T> list){
        return new CommonList<T>("200", "", list);
    }

    /**
     * 失败消息
     * @param message
     * @param <T>
     * @return
     */
    public static<T> CommonList<T> fail(String message){
        return new CommonList<T>("500", message, null);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
